/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package th.manager;

import com.google.inject.Inject;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author fikri
 */
public class ResponseManager {
    @Inject
    protected com.google.inject.Provider<Session> sessionProvider;
    
    
    public String getResponseMessage( String code, String msgId ) {
        Session session = sessionProvider.get();
        Query query = session.createQuery(
                "select a.mesej from KodRespon a " +
                "where a.kodResponPK.kod = :kod and a.kodResponPK.msgId = :msgId");      
        query.setString("kod", code);
        query.setString("msgId", msgId);
        return ( query.uniqueResult() != null ? (String)query.uniqueResult() : "" );
    }
    
}
